package cn.com.oceansoft.modules.error.controller;

import cn.com.oceansoft.framework.kits.ApiResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static org.springframework.web.bind.annotation.RequestMethod.GET;

/**
 * Created by Andy on 16/10/1.
 */
@RestController
@RequestMapping("error")
public class ErrorHandlerController {

    @RequestMapping(value = "400", method = GET)
    public ApiResult error400() {
        return ApiResult.failure(400, "请求参数错误！");
    }

    @RequestMapping(value = "404", method = GET)
    public ApiResult error404() {
        return ApiResult.failure(404, "请求未找到！");
    }

    @RequestMapping(value = "415", method = GET)
    public ApiResult error415() {
        return ApiResult.failure(415, "请求内容格式错误！");
    }

    @RequestMapping(value = "500", method = GET)
    public ApiResult error500() {
        return ApiResult.failure(500, "服务器错误！");
    }
}
